package datalayer;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class DataConnection {
	
	// TODO Windows 7 PC
	//	protected String url = "jdbc:mysql://192.168.1.102:3306/projectm";
	//	protected String user = "root";
	//	protected String password = "scalda1234";

	//  TODO Windows Server 2012
	//	protected String url = "jdbc:mysql://192.168.1.102:3306/projectm";
	//	protected String user = "root";
	//	protected String password = "scalda1234";

	//  Server van Mart-Jan
	protected String url = "jdbc:mysql://martcor.nl:3306/deb42181_prom";
	protected String user = "deb42181_prom";
	protected String password = "Vgj7KtOj";
	
	protected Connection conn;
	protected Statement stmt;
	protected ResultSet rs;
	protected Boolean del;
	protected Boolean ins;
	protected PreparedStatement pst;
	
	// Method for closing the database connection
		public void closeConn(){
			try {
				conn.close();			
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}

		// Method for opening a database connection.
		public void openConn(){
			try{
				//sClass.forName("com.mysql.jdbc.Driver").newInstance();
				conn = DriverManager.getConnection(url, user, password);
			}
			catch(SQLException err){
				System.out.println(err.getMessage());

			}
		}

}
